<template>
    <view class="ddbox">
        <view class="title">{{title}}</view>
        <view class="add_time" v-if="add_time">{{add_time}}</view>
        <view class="content">
            <rich-text :nodes="content"></rich-text>
        </view>
    </view>
</template>

<script>
    import parseHtml from '@/common/htmlrich.js'
    export default{
        data() {
          return {
              title:"",
              add_time:"",
              content:"",
              db:'',
              id:""
          };
        },
        onLoad(option){
            this.db = option.db
            this.id = option.id
            this.getcontent()
        },
        methods:{
            getcontent(){
                this.$api.get(`index/richtext?db=${this.db}&id=${this.id}`).then((res)=>{
                    this.title = res.data.title
                    this.content = parseHtml(res.data.content)
                    uni.setNavigationBarTitle({
                        title:this.title
                    })
                }).catch((err)=>{
                    console.log(err)
                })
            }
        }
    }
</script>

<style lang="scss">
    page{
        background-color: #fff;
    }
    .ddbox{
        padding: 10px;
    }
    .title{
        font-weight: bold;
        font-size: 28rpx;
        text-align: center;
    }
</style>